#!/usr/bin/env python
#-*- coding: utf-8 -*-

import numpy as np
import time

import pat.vehicles.fixed_wing.dynamic_model_python_basic as dm
import pat.vehicles.fixed_wing.control_3d                 as ctl
import pat.vehicles.fixed_wing.plot_3d                    as mp

_dm = dm.DynamicModel()
print _dm.p

# finds trim conditions
va=70; gamma=0.
Xe, Ue = ctl.get_trim_cst_path(va=70., gamma=0., dm_param=_dm.p, debug=True)


dt = 1./25.
n_loop = 1000

t0 = time.time()
for i in range(n_loop):
    _dm.run(dt, Ue)
t1 = time.time()

print "\n\nran {:d} loops of {:.2f}s in {:f}s ({:.1f} * real time)\n".format(n_loop, dt, t1-t0, n_loop*dt/(t1-t0))
